<?php
class Default_Model_User
{
    protected $_name;
    protected $_birthday;
	protected $_sex;
	protected $_phone;
	protected $_username;
    protected $_email;
    protected $_pass;
    protected $_registedDate;
    protected $_modifyDate;
    protected $_id;
 
    public function __construct(array $options = null)
    {
        if (is_array($options)) {
            $this->setOptions($options);
        }
    }
 
    public function __set($name, $value)
    {
        $method = 'set'  $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid user property');
        }
        $this->$method($value);
    }
 
    public function __get($name)
    {
        $method = 'get'  $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid user property');
        }
        return $this->$method();
    }
 
    public function setOptions(array $options)
    {
        $methods = get_class_methods($this);
        foreach ($options as $key => $value) {
            $method = 'set'  ucfirst($key);
            if (in_array($method, $methods)) {
                $this->$method($value);
            }
        }
        return $this;
    }
	
 // name
    public function setName($name)
    {
        $this->_name = (string) $name;
        return $this;
    }
 
    public function getName()
    {
        return $this->_name;
    }

// birthday	
	public function setBirthday($birthday)
    {
        $this->_birthday = (string) $birthday;
        return $this;
    }
 
    public function getBirthday()
    {
        return $this->_birthday;
    }
 
 // sex
	public function setSex($sex)
    {
        $this->_sex = (int) $sex;
        return $this;
    }
 
    public function getSex()
    {
        return $this->_sex;
    }
	
 // phone
	public function setPhone($phone)
    {
        $this->_phone = (int) $phone;
        return $this;
    }
 
    public function getPhone()
    {
        return $this->_phone;
    }
	
// pass
	public function setPass($pass)
    {
        $this->_pass = (int) $pass;
        return $this;
    }
 
    public function getPass()
    {
        return $this->_pass;
    }
 
 // registed date
	public function setRegistedDate($registedDate)
    {
        $this->_registedDate = (int) $registedDate;
        return $this;
    }
 
    public function getRegistedDate()
    {
        return $this->_registedDate;
    }
 
 // modify date
	public function setModifyDate($modifyDate)
    {
        $this->_modifyDate = (int) $modifyDate;
        return $this;
    }
 
    public function getModifyDate()
    {
        return $this->_modifyDate;
    }

// published
	public function setPublished($published)
    {
        $this->_published = (int) $published;
        return $this;
    }
 
    public function getPublished()
    {
        return $this->_published;
    }
 
// email
    public function setEmail($email)
    {
        $this->_email = (string) $email;
        return $this;
    }
 
    public function getEmail()
    {
        return $this->_email;
    }

    public function setCreated($ts)
    {
        $this->_created = $ts;
        return $this;
    }
 
    public function getCreated()
    {
        return $this->_created;
    }

// id	
    public function setId($id)
    {
        $this->_id = (int) $id;
        return $this;
    }
 
    public function getId()
    {
        return $this->_id;
    }
}